<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function reverse (arr) {
            var result = [];
            for (var i = 0; i < arr.length; i++) {
                result.unshift(arr[i]);
            }
            return result;
        }
        var arr1 = [22, 30, 56, 57, 5879, 21];
        console.log(reverse(arr1));

        function reverse1 (arr) {
            var result = [];
            for (var i = arr.length - 1; i >= 0; i--) {
                result.push(arr[i]);
            }
            return result;
        }
        var arr2 = [22, 30, 56, 57, 5879, 21];
        console.log(reverse1(arr2));
    </script>
</body>
</html>